package com.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.server.pojo.Users;
import com.server.dao.UsersDao;
import com.server.service.UsersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.server.utils.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 平台用户信息表 服务实现类
 * </p>
 *
 * @author ckick
 * @since 2025-09-20 09:29:27
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersDao, Users> implements UsersService {
    @Autowired
    UsersDao usersDao;
    @Autowired
    RedisUtils redisUtil;
    @Override
    public Boolean delUserToken(Integer phone) {
        if(phone!=null || redisUtil.hasKey("token:"+phone)){
            redisUtil.del("token:"+phone);
            return true;
        }
        return false;
    }

    @Override
    public Integer[] getMessage() {
        return usersDao.getMessage();
    }

    @Override
    public List<Users> getLikeUser(String key) {
        return usersDao.getLikeUser(key);
    }

    @Override
    public IPage<Users> UserPage(IPage<Users> p, QueryWrapper<Users> wrapper) {
        return usersDao.UserPage(p,wrapper);
    }
}
